package top.laoshuzi.designpatterns.base.created.abstract_factory.kotlin

/**
 * 工厂管理类
 */
class FactoryManager {

    companion object {

        const val TYPE_FACTORY_A: Int = 1
        const val TYPE_FACTORY_B: Int = 2

        fun createFactory(factoryType: Int): Factory {
            when (factoryType) {
                1 -> return FactoryA()
                2 -> return FactoryB()
                else -> throw NullPointerException("无效工厂类型")
            }
        }
    }

}